package com.teamone.mobilewatch.accessor;

public class BackendException extends Exception {
	
	public static int BAD_RESPONSE = 1;
	public static int ERROR = 2;
	public static int IO_EXCEPTION = 3;
	
	
	private static final long serialVersionUID = -1295941160111280778L;
	private int errCode;

	/**
	 * Create a new BackendException with the specified message and code
	 * 
	 * @param detailMessage
	 *            - exception message
	 * @param errCode
	 *            - error code
	 */
	public BackendException(String detailMessage, int errCode) {
		super(detailMessage);
		this.errCode = errCode;
	}

	/**
	 * Returns error code
	 * 
	 * @return
	 */
	public int getCode() {
		return errCode;
	}

	/**
	 * Returns string representation of the object
	 */
	public String toString() {
		return "BackendException: [" + errCode + "] "
				+ getMessage();
	}

}
